package com.zhangsun.system.controller;

import com.zhangsun.base.bean.ResponseData;
import com.zhangsun.common.utils.ResponseUtil;
import com.zhangsun.system.service.LogoutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 登出
 */
@RestController
public class LogoutController {

    @Autowired
    private LogoutService logoutService;

    /**
     * 登出
     *
     * @param request 请求
     * @return 结果
     */
    @PostMapping(value = "/logout")
    public ResponseData logout(HttpServletRequest request) {
        logoutService.logout(request);
        return ResponseUtil.success("登出成功");
    }

}
